<?php

class Kd_Data_Dcl_Expression_Groupby extends Kd_Data_Dcl_Expression_Base {
	
	private $_fields = array();
	private $_having = NULL;

    public function __construct() {
        parent::__construct();
    }
    
    public function getFields(){
    	return $this->fields;
    }
    
    public function setFields($value){
    	$this->fields = $value;
    	return $this;
    }
    
    public function having(){
    	if(is_null($this->_having)){
    		$this->_having = new Kd_Data_Dcl_Expression_Having();
    		$this->_having->setParentExpression($this);
    		$this->_having->setOwner($this->getOwner());
    	}
    	return $this->_having;
    }
    
    public function getHaving(){
    	return $this->_having;
    }

    public function getExpressionType(){
        return 'groupby';
    }
}